#include "mycarobject.h"

//-----------METHOD OVERRIDES------------------------------------

/***********************************
*
***********************************/
bool CMyCarObject::initialise(LJMUUtilShaderTexPlain* pshader, ID3D10Device* pdevice,std::wstring ptexfilename, int pspritewidth, int pspriteheight)
{
	//Call the Base Initialise Function
	return CMyGameObject::initialise(pshader,pdevice,ptexfilename,pspritewidth,pspriteheight);
}

/***********************************
*
***********************************/
bool CMyCarObject::update(float ptpf)
{
	this->_velocity += this->_acceleration * ptpf;

	const float tsintheta = sin(D3DXToRadian(this->_angle));
	const float tcostheta = cos(D3DXToRadian(this->_angle));
	float tdeltamag = this->_velocity * ptpf;

	if(tdeltamag > 0)
	{
		tdeltamag = tdeltamag;
	}
	this->_x_pos -= (tdeltamag * tsintheta);
	this->_y_pos += (tdeltamag * tcostheta);

	//Call the Base Update Function
	return CMyGameObject::update(ptpf);	
}

/***********************************
*
***********************************/
bool CMyCarObject::render(float ptpf,D3DXMATRIX pview, D3DXMATRIX portho)
{
	//Call the Base Render Function
	return CMyGameObject::render(ptpf,pview,portho);
}

/***********************************
*
***********************************/
bool CMyCarObject::cleanup()
{
	//Call the Base Cleanup Function
	return CMyGameObject::cleanup();
}

//-----------PUBLIC METHODS--------------------------------------

/***********************************
*
***********************************/
void  CMyCarObject::addVelocity(float pvelocity)
{
	this->_velocity += pvelocity;
}

/***********************************
*
***********************************/
void  CMyCarObject::addAcceleration(float pacceleration)
{
	this->_acceleration += pacceleration;
}